<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="menu.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.3.0/lodash.js"></script>
  <script src="https://cdn.polyfill.io/v1/polyfill.js?features=Element.prototype.closest"></script>
  <script src="menu.js"></script>
</head>

<body>

  <script type="text/template" id="menu-template">
    <div class="menu">
      <span class="title"><%-title%></span>
    </div>
  </script>

  <script type="text/template" id="menu-list-template">
    <ul>
      <% items.forEach(function(item) { %>
        <li>
          <%-item%>
        </li>
        <% }); %>
    </ul>
  </script>

  <script>
    var menu = new Menu({
      title: "Сладости",
      template: _.template(document.getElementById('menu-template').innerHTML),
      listTemplate: _.template(document.getElementById('menu-list-template').innerHTML),
      items: [
        "Торт",
        "Пончик",
        "Пирожное",
        "Шоколадка",
        "Мороженое"
      ]
    });

    document.body.appendChild(menu.getElem());
  </script>

</body>

</html>